package com.dk.controller;


import com.dk.service.WorkstationsService;
import com.dk.vo.WorkstationsVO;
import com.dongdongshop.data.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 工作站controller
 * </p>
 *
 * @author wbh
 * @since 2023-03-21
 */
@RestController
@RequestMapping("workstations")
public class WorkstationsController {

    @Autowired
    private WorkstationsService workstationsService;

    @GetMapping("getInfoList")
    public Result getInfoList(WorkstationsVO workstationsVO) {
        List<WorkstationsVO> workstationsVOS = workstationsService.getInfoList(workstationsVO);
        return Result.OK().setData(workstationsVOS);
    }

    @PostMapping("insertInfoWorkstations")
    public Result insertInfoWorkstations(WorkstationsVO workstationsVO) {
        workstationsService.insertInfoWorkstations(workstationsVO);
        return Result.OK();
    }

    @GetMapping("getInfoWorkstationsById")
    public Result getInfoWorkstationsById(String workstationId) {
        WorkstationsVO workstationsVO = workstationsService.getInfoWorkstationsById(workstationId);
        return Result.OK().setData(workstationsVO);
    }

    @PutMapping("updateInfoWorkstationsById")
    public Result updateInfoWorkstationsById(WorkstationsVO workstationsVO) {
        workstationsService.updateInfoWorkstationsById(workstationsVO);
        return Result.OK();
    }

    @DeleteMapping("deleteInfoWorkstationsById")
    public Result deleteInfoWorkstationsById(String workstationId) {
        workstationsService.deleteInfoWorkstationsById(workstationId);
        return Result.OK();
    }
}

